<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품리스트</title>
<SCRIPT type="text/javascript" src="../js/jquery-1.8.2.js"></SCRIPT>
<SCRIPT type="text/javascript">
	$(document).ready(function() {
		$("#btnAddProduct").click(function() {
			location.href = "writeform.htm";
		});
	});
</SCRIPT>
<LINK href="../css/shop.style.css" rel="stylesheet">
</head>
<body>
	<table>
		<tr>
			<td></td>
		</tr>
		<tr>
			<td></td>
			<td>
				<table width="800" border="1">
					<tr>
						<th>번호</th>
						<th>상품코드</th>
						<th>상품명</th>
						<th>판매가격</th>
						<th>재고</th>
						<th>등록일</th>
					</tr>
					<c:forEach var="p" items="${list}" varStatus="s">
						<c:if test="${p.prodDel=='Y'}">
							<tr bgcolor="lightgray">
								<td>${max-s.index}</td>
								<td><a href="read.htm?pg=${pg}&prodCode=${p.prodCode}">${p.prodCode}</a></td>
								<td>${p.prodName}</td>
								<td>${p.prodOutPrice}</td>
								<td>${p.prodStock}</td>
								<td><fmt:formatDate value="${p.prodRegdate}" pattern="yyyy/MM/dd" /></td>
							</tr>
						</c:if>
						<c:if test="${p.prodDel=='N'}">
							<tr>
								<td>${max-s.index}</td>
								<td><a href="read.htm?pg=${pg}&prodCode=${p.prodCode}">${p.prodCode}</a></td>
								<td>${p.prodName}</td>
								<td>${p.prodOutPrice}</td>
								<td>${p.prodStock}</td>
								<td><fmt:formatDate value="${p.prodRegdate}" pattern="yyyy/MM/dd" /></td>
							</tr>
						</c:if>
					</c:forEach>
					<tr align="right">
						<td colspan="8"><input type="button" value="상품등록" id="btnAddProduct"></td>
					</tr>
				</table>
				<div style="width: 800pix; margin: 0 auto; text-align: center;">
					<c:if test="${pg > linkSize}">
			[<a href="list.htm?pg=1">◀◀</a>] 
			[<a href="list.htm?pg=${pg-1}">◀</a>] 
			</c:if>
					<c:forEach var="i" begin="${beginLink}" end="${endLink}">
						<c:if test="${pg == i}">[${i}] </c:if>
						<c:if test="${pg != i}">[<a href="list.htm?pg=${i}">${i}</a>] </c:if>
					</c:forEach>
					<c:if test="${endLink < totalPage}">
            [<a href="list.htm?pg=${endLink+1}">▶</a>]
            [<a href="list.htm?pg=${totalPage}">▶▶</a>]
            </c:if>
				</div>
			</td>
		</tr>
	</table>
</body>
</html>